# Tanım: Çoklu önyükleme yükleyicisi
# URL: http://www.gnu.org/software/grub/
# Pcakager: alihan-ozturk8@hotmail.com
# Gerekler: freetype help2man efivar efibootmgr os-prober dosfstools fuse mtools libisoburn
# Grup: sistem

isim=grub
surum=2.02-beta3
devir=1
kaynak=( ftp://alpha.gnu.org/gnu/grub/grub-2.02~beta3.tar.xz \
         http://source.pisilinux.org/1.0/grub2_extras_915resolution_r10.tar.xz \
         unifont-6.3.20131217.bdf \
         milis_name.patch \
         initramfs.patch \
         grub_mkconfig.patch \
         grub.default)

derle() {
cd $isim-2.02~beta3

patch -Np1 -i ../milis_name.patch
patch -i $SRC/initramfs.patch util/grub.d/10_linux.in
patch -Np1 -i ../grub_mkconfig.patch

cp $SRC/unifont-6.3.20131217.bdf $SRC/$isim-2.02~beta3/unifont.bdf

mkdir -p SRC/$isim-2.02~beta3/grub-extras/915resolution
install -d "$SRC/$isim-2.02~beta3/grub-extras"
cp -r "$SRC/915resolution" "SRC/$isim-2.02~beta3/grub-extras/915resolution"
export GRUB_CONTRIB="$SRC/$isim-2.02~beta3/grub-extras/"

unset CFLAGS
unset CPPFLAGS
unset CXXFLAGS
unset LDFLAGS
unset MAKEFLAGS

./autogen.sh
./configure --disable-werror \
            --with-platform=pc \
	     	--target=i386 \
		    --enable-mm-debug \
		    --enable-nls \
		    --enable-device-mapper \
		    --enable-cache-stats \
		    --enable-boot-time \
		    --enable-grub-mkfont \
	    	--enable-grub-mount \
	    	--prefix="/usr" \
			--bindir="/usr/bin" \
			--sbindir="/usr/bin" \
			--mandir="/usr/share/man" \
			--infodir="/usr/share/info" \
			--datarootdir="/usr/share" \
			--sysconfdir="/etc" \
			--program-prefix="" \
	    	--with-bootdir=/boot \
		    --with-grubdir=grub

cp -r "$SRC/$isim-2.02~beta3" "$SRC/$isim-2.02~beta3-efi"
cd $SRC/$isim-2.02~beta3-efi

unset CFLAGS
unset CPPFLAGS
unset CXXFLAGS
unset LDFLAGS
unset MAKEFLAGS

./autogen.sh
./configure --with-platform=efi \
			--target=x86_64  \
			--enable-mm-debug \
			--enable-nls \
			--enable-device-mapper \
			--enable-cache-stats \
			--enable-boot-time \
			--enable-grub-mkfont \
			--enable-grub-mount \
			--prefix="/usr" \
			--bindir="/usr/bin" \
			--sbindir="/usr/bin" \
			--mandir="/usr/share/man" \
			--infodir="/usr/share/info" \
			--datarootdir="/usr/share" \
			--sysconfdir="/etc" \
			--program-prefix="" \
			--with-bootdir=/boot \
			--with-grubdir=grub \
			--disable-silent-rules \
			--disable-werror

cd $SRC/$isim-2.02~beta3
make dist
make
cd $SRC/$isim-2.02~beta3-efi
make

cd $SRC/$isim-2.02~beta3
./grub-mkfont -o unicode.pf2 unifont.bdf
mkdir -p $PKG/boot/grub
cp $SRC/$isim-2.02~beta3/unicode.pf2 $PKG/boot/grub
make DESTDIR=$PKG install

cd $SRC/$isim-2.02~beta3-efi
make DESTDIR=$PKG install

mkdir -p $PKG/etc/default/grub
install -D -m0644 "$SRC/grub.default" "$PKG/etc/default/grub"

}
